import axios from "@/request";


// 获取广告位列表
const getArticle = (params: any) => {
    return axios.get("/rest/ads", {
        params
    })
}


// 获取分页数据
const getPageList = (url: string, params: any) => {
    return axios.get(url, {
        params
    })
}

// 获取分类
const getCategories = () => {
    return axios.get("/rest/categories")
}

// 添加文章
const addArticleItem = (params: any) => {
    return axios.post("/rest/articles", params)
}

// 获取文章详情
const getArticleDetail = (id: string) => {
    return axios.get("/rest/articles/" + id)
}

// 编辑文章详情
const editArticleDetail = (id: string, params: any) => {
    return axios.put("/rest/articles/" + id, params)
}

export {
    getArticle,
    getPageList,
    addArticleItem,
    getCategories,
    getArticleDetail,
    editArticleDetail
}